package com.wanmait.community.controller;

import com.github.pagehelper.PageInfo;
import com.wanmait.community.entity.AdminRole;
import com.wanmait.community.service.AdminRoleService;
import com.wanmait.community.util.AjaxResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@ResponseBody
@RequestMapping("adminRole")
public class AdminRoleController {
    @Resource
    private AdminRoleService adminRoleService;
    @PostMapping("list")
    public AjaxResult list(@RequestBody AdminRole adminRole,Integer pageNum) {
        Integer pageSize = 4;
        PageInfo<AdminRole> adminRolePageInfo = adminRoleService.findPage(adminRole,pageNum,pageSize);
        return AjaxResult.success().put("adminRolePageInfo",adminRolePageInfo);
    }
    @GetMapping("selectAdminRoleById")
    public AjaxResult getAdminRoleById(Integer adminId,Integer roleId) {
        AdminRole adminRole = adminRoleService.getAdminRoleById(adminId,roleId);
        return AjaxResult.success().put("adminRole",adminRole);
    }
}
